class_name UnitWhiteTiger
extends UnitFlyMagic


func shoot_magic():
	for index in range(5):
		shoot_gravity_magic()
		await get_tree().create_timer(0.5).timeout
	

func shoot_gravity_magic():
	if not attack_target: return
	
	var config = unit_data.config
	var hit_target = attack_target
	
	var inst = (ResourceManager.get_resource("particle_gravity_attack_tip") as PackedScene).instantiate() as GravityAttackTip
	level.particles_parent.add_child(inst)
	inst.global_position = hit_target.global_position
	inst.sender = self
	inst.attack = config.main_attack
	inst.critical_rate = config.main_critical_attack_rate
	inst.critical_bonus = config.main_critical_attack_bonus
	inst.knockback = config.main_attack_knockback
	inst.affect_vertical_velocity = config.main_attack_affect_vertical_velocity
	inst.cam_shake_duration = config.main_attack_cam_shake_duration
	inst.cam_shake_strength = config.main_attack_cam_shake_intensity
	inst.is_enemy = true


func play_magic_animation():
	animation_player.play("magic")
